#ifndef __OS_INIT_H
#define __OS_INIT_H
#include "os_def.h"
extern OS_INIT gOsInit; 
OS_INLINE OS_UINT8_T   OsGetBitCount(OS_UINT32_T u32) {

    OS_UINT32_T tmp = u32 - ((u32 >> 1) & 033333333333) -

    ((u32 >> 2) & 011111111111);

    tmp = ((tmp + (tmp >> 3)) & 030707070707);

    tmp = (tmp + (tmp >> 6));

    tmp = (tmp + (tmp >> 12) + (tmp >> 24)) & 077;


    return ((OS_UINT8_T) tmp);

}

OS_INLINE OS_UINT8_T OsGetID(OS_UINT32_T u32)
{
}

OS_INLINE void OsDeletID(OS_UINT32_T u32)
{
}
#define OS_GET_TASK_COUNT()     OsGetBitCount(gOsInit.osTaskID)
#define OS_GET_SEM_COUNT()      OsGetBitCount(gOsInit.osSemID)
#define OS_GET_MUTEX_COUNT()    OsGetBitCount(gOsInit.osMutexID)
#define OS_GET_SWTMR_COUNT()    OsGetBitCount(gOsInit.osSwtmrID)

#define OS_GET_TASK_ID()        OsGetID(gOsInit.osTaskID)
#define OS_GET_SEM_ID()         OsGetID(gOsInit.osSemID)
#define OS_GET_MUTEX_ID()       OsGetID(gOsInit.osMutexID)
#define OS_GET_SWTMR_ID()       OsGetID(gOsInit.osSwtmrID)


#define OS_GET_TASK_LIST()      gOsInit.osTaskCBList
#define OS_GET_SEM_LIST()       gOsInit.osSemList
#define OS_GET_MUTEX_LIST()     gOsInit.osMutexList
#define OS_GET_SWTMR_LIST()     gOsInit.osSwtmrList

OS_INLINE void OsSetTick(void)
{
    gOsInit.osTick++;
}

OS_INLINE OS_UINT32_T OsGetTick(void)
{
    return gOsInit.osTick;
}


#endif
